package com.example.javaeefinal.controller;

import com.example.javaeefinal.utils.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @Auther: Lai Wenhao
 * @Date: 2023/12/29 12:56
 * 全局异常捕捉
 **/
@ControllerAdvice
public class Exception {
    @ExceptionHandler(value = java.lang.Exception.class)
    public Result exceptionHandler(java.lang.Exception e) {
        System.out.println("全局异常捕获>>>:" + e);
        return Result.error("1",e.toString());
    }
}
